const express = require('express')
const http = require('http')
const path = require('path')

const app = express()
const server = http.createServer(app)
const io = require('socket.io')(server, { cors: true })

io.on('connection', socket => {
    const userId = socket.id
    console.log('有一个用户连接~', userId)
    socket.on('disconnect', () => {
        console.log(`用户${userId}断开连接~`);
    })
    socket.on('loginSucceed', data => {
        console.log(data);
    })
})

server.listen(80, () => {
    console.log('服务器连接成功~');
})